"""DgPysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls import url, include
from django.views.generic.base import TemplateView
from django.conf.urls.static import static
from AppBase.views import LoginView, RegistView, LogoutView,error404,sendmessage,MessageLoginView
from MallApp.views import IndexView

urlpatterns = [
                  url(r"^admin", admin.site.urls),  # DjangoAdmin后台管理路由
                  url(r"^index", IndexView.as_view(), name="index"),
                  url(r"^register$", RegistView.as_view(), name="register"),  # 注册页面
                  url(r"^login$", LoginView.as_view(), name="login"),  # 登录页面
                  url(r"^logout", LogoutView.as_view(), name="logout"),  # 注销登录
                  url(r'^sendmessage$', sendmessage, name='sendmessage'),  # 短信发送
                  url(r'^messagelogin$', MessageLoginView.as_view(), name='messagelogin'),  # 短信登录验证
                  url(r"^base", include("AppBase.urls")),
                  url(r"^mall/", include("MallApp.urls")),
                  url(r"^$", IndexView.as_view()),  # 默认重定向到主页
                  url(r"^(?!media)", error404, name="error404"),  # 排除图片资源 其他未定义转到404错误页面  (django自带404错误调试模式不能用)

              ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)  # 静态图片资源路径
